function throttle(fn:Function, time:number) {
  let timer: null | number = null
  return function()  {
    if (!timer) {
      timer = window.setTimeout(function(){
        fn.apply(this,arguments)
        clearTimeout(Number(timer))
        timer = null
      }, time)
    }
  }
}

export default throttle

export  { throttle }